function Dashboard() {

	this.fillFlight = function(domElement) {

		for ( var i = 0; i < crvapp.stockageUtil.listeVolsFull.length; i++) {
			var vol = crvapp.stockageUtil.listeVolsFull[i];
			var tr = document.createElement("tr");
			var td1 = document.createElement("td"), idTD = document
					.createElement("td"), uicTD = document.createElement("td"), oaci1TD = document
					.createElement("td"), gdhdTD = document.createElement("td");
			var oaci2TD = document.createElement("td"), gdhfTD = document
					.createElement("td"), missionTD = document
					.createElement("td"), etatTD = document.createElement("td");

			tr.dataset.id = vol.idVol;
			tr.setAttribute("onclick", "crvapp.dashboard.flightDetails(this)");
			td1.innerHTML = "";
			idTD.innerHTML = vol.indicatif;
			uicTD.innerHTML = vol.unite.codeUic;
			
			var gdhBegin = vol.gdhDebut != "" ? moment(vol.gdhDebut).format("DD-MM-YYYY hh:mm") : "";
			var gdhEnd = vol.gdhFin != "" ? moment(vol.gdhFin).format("DD-MM-YYYY hh:mm") : "";
			gdhdTD.innerHTML = gdhBegin; 
			oaci1TD.innerHTML = vol.listeDecollagesAtterrissages[0].lieuOACI.codeOaci;
			oaci2TD.innerHTML = vol.listeDecollagesAtterrissages[vol.listeDecollagesAtterrissages.length - 1].lieuOACI.codeOaci;
			gdhfTD.innerHTML = gdhEnd;
			missionTD.innerHTML = vol.numeroMission;
			switch (i % 3) {
			case 0:
				etatTD.innerHTML = "OK";
				break;
			case 1:
				etatTD.innerHTML = "A Faire";
				break;
			case 2:
				etatTD.innerHTML = "En cours";
				break;
			default:
				break;
			}

			 tr.appendChild(td1);
			 tr.appendChild(idTD);
			 tr.appendChild(uicTD);
			 tr.appendChild(oaci1TD);
			 tr.appendChild(gdhdTD);
			 tr.appendChild(oaci2TD);
			 tr.appendChild(gdhfTD);
			 tr.appendChild(missionTD);
			 tr.appendChild(etatTD);
			 domElement.appendChild(tr);
		}
	};

	this.flightDetails = function(domElement) {
		var flightID = domElement.dataset.id;
		var flight = new Vol();

		for ( var i = 0; i < crvapp.stockageUtil.listeVolsFull.length; i++) {
			crvapp.stockageUtil.listeVolsFull[i].idVol === flightID ? flight = crvapp.stockageUtil.listeVolsFull[i]	: null;
		}
		
		crvapp.crvaDetails = new CrvaDetails();
		crvapp.crvaDetails.loadCrva(flight);
		window.navigation.next();
	};
	
	this.newFlight = function() {
		var flight = new Vol();
		crvapp.crvaDetails = new CrvaDetails();
		crvapp.crvaDetails.isNewFlight = true;
		crvapp.crvaDetails.loadCrva(flight);
	};

	
	this.createDictionnaryTableList =  function() {
		var tbodyNature = document.getElementById("mission_nature_list_tbody");
		var tbodyManoeuvre = document.getElementById("mission_manoeuvre_list_tbody");
		var tbodyType = document.getElementById("mission_type_list_tbody");
		var tbodyCodeServiceAerien = document.getElementById("type_heure_tbody");
		
		var dataNature = crvapp.dictionnary.natureMissionDictionnary;
		var dataManoeuvre = crvapp.dictionnary.manoeuvreMissionDictionnary;
		var dataType = crvapp.dictionnary.typeMissionDictionnary;
		var dataCodeServiceAerien = crvapp.dictionnary.codeServiceAerienDictionnary;
		
		this.createDictionnaryStructure(dataNature, tbodyNature);
		this.createDictionnaryStructure(dataManoeuvre, tbodyManoeuvre);
		this.createDictionnaryStructure(dataType, tbodyType);
		this.createDictionnaryStructure(dataCodeServiceAerien, tbodyCodeServiceAerien);
	};
	
	this.createDictionnaryStructure = function(dataTable, tbodyParent) {
		for ( var i = 0; i < dataTable.length; i++) {
			var row = document.createElement("tr");
			var tdCode = document.createElement("td");
			var tdLabel = document.createElement("td");
			
			tdCode.innerHTML = dataTable[i][0];
			tdLabel.innerHTML = dataTable[i][1];
			
			row.appendChild(tdCode);
			row.appendChild(tdLabel);
			tbodyParent.appendChild(row);
		}
	};
	
}